<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Confirm Order</title>
    <link rel="stylesheet" type="text/css" href="<s:url value='/CSS/order/order_confirm.css'/>"/>
  </head>
  <body>
    <div class="container">
      <div class="head">
        <s:include value="/WEB-INF/JSP/head.jsp"/>
      </div>
      <div class="body">
        <div class="left">
          <s:include value="/WEB-INF/JSP/order/left.jsp"/>
        </div>
        <div class="right">
          <s:form action="orderAction_save" namespace="/order">
            <div class="order-confirm">
              <s:hidden name="order.realName"></s:hidden>
              <s:hidden name="order.tel"></s:hidden>
              <s:hidden name="order.address"></s:hidden>
              <s:hidden name="order.payment"></s:hidden>
              <s:set value="%{0}" var="totalPrice"></s:set>
              <div class="title">Confirm Order</div>
              <table>
                <tr class="tr1">
                  <td class="td1">ProductName</td>
                  <td class="td2">MarketPrice</td>
                  <td class="td3">SalesPrice</td>
                  <td class="td4">Quantity</td>
                </tr>
                <s:iterator value="#session.cart" status="stat">
                <s:set value="%{#totalPrice + product.salesPrice * quantity}" var="totalPrice"></s:set>
                <tr class="tr2" id="row_<s:property value='#stat.index'/>"
                      onmouseover="onChange('row_<s:property value='#stat.index'/>', 0)" 
                      onmouseout="onChange('row_<s:property value='#stat.index'/>', 1)">
                  <td class="td1"><s:property value="product.name"/></td>
                  <td class="td2"><s:property value="product.marketPrice"/></td>
                  <td class="td3"><s:property value="product.salesPrice"/>
                    <s:if test="product.salesPrice < product.marketPrice">
                      <br/>(Saving:<b><s:property value="(product.marketPrice - product.salesPrice) * quantity"/></b>)
                    </s:if>
                  </td>
                  <td class="td4"><s:property value="quantity"/></td>
                </tr>
                </s:iterator>
              </table> 
              <div class="total-price">
                TotalPrice:<span><b><s:property value="#totalPrice"/></b></span>&nbsp;&nbsp;
              </div>
              <div class="receipt-information">
                <div class="information-title">Receipt Information:</div>
                <div class="information-unit">
                  Consignee:&nbsp;<s:property value="order.realName"/>
                </div>
                <div class="information-unit">
                  Tel:&nbsp;<s:property value="order.tel"/>
                </div>
                <div class="information-unit">
                  Address:&nbsp;<s:property value="order.address"/>
                </div>
                <div class="information-unit">
                  Payment:&nbsp;<s:property value="order.payment"/>
                </div>
              </div> 
              <div class="order-confirm-submit">
                <s:submit cssClass="submit" value="Confirm"/>
              </div>
            </div>
          </s:form>
        </div>
      </div>
      <div class="foot">
        <s:include value="/WEB-INF/JSP/foot.jsp"/>
      </div>
    </div>
    <script type="text/javascript" src="<s:url value='/JS/jquery-1.7.2.min.js'/>"></script>
    <script type="text/javascript" src="<s:url value='/JS/common.js'/>"></script>
  </body>
</html>